Correcting a runtime error