Fixed errors in the code