2004 400ex

Hello I’m new to the forum and atvs. Purchased a used 2004 400ex. I heard some ticking in the head and assumed it needed a valve adjustment. I went by the specs in my clymer book. Now it won’t stay idling unless I back out the throttle cable almost all the way or it just stalls. Not sure what’s wrong. Any suggestions would be great. Thank you.