Improved logging for invalid data