More bug fixes in error handling functionality