Add another safety check for better debugging output