Fixing code errors