corrected some wrong code