small fix error handling

Error message where printed out at wrong position. This is now fixed.