Ensure that chmod 777 is done at the end