handle exceptions better