Fix syntax
Only log write errors when debug is enabled