nsc: deploy_code: moved clean-up to the top