improved error handling
better error message