fixed stack smashing error lol