Improve error message for easier debugging