Fixed errors in code