corrected some code