chown and chmod the folder only after creation

this way there is not the risk to chomod-ing
a pre-existent folder. Overall this was a bug