handles exceptions better