Fix permissions by reordering the commands