Fixed code errors