Improved the deployment script to add rollbacks and fixed some errors