Added -p to tar-command to preserve permissions and fixed a few errors