Made deploy scripts more robust