`` turns out , the king was upset because he told carnegie to stop sneaking out of his room at night and stealing juice boxes from the fridge , so he had the sorcerer use his magic to turn him into a caterpillar . ''