fixed errors in code