* fixed a few error handling