Fix bugs in deployment scripts