Added some more detailed error messages if we are in debug mode