fixed error handling, messages, cleanups