Fix and add a debug message.
Add missing return on error.