Move validation check in clean()

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>