Prospero thinks Ferdinand is a spy and puts him in a jail. As a punishment, Ferdinand's task is to gather up logs and pile them up, as he says in the beginning of act 3 : "I must remove / some thousand of these logs and pile them up, / upon a sore injunction".