Make a some printfs into error log calls.
Fix a typo in a log message
Also moved a logging statement after an if statement check. We don't want to signify creation of something before checking its validity.