Fix code errors