fixe a few mistakes in exceptions handeling