various changes regarding error handling