Added error messages for debugging