Small fixes to make code readble and error log more useful