Fixed the error messaging for better errors