How can I get rid of runtime error issue?