Fix bugs in deploy function + add logging (OMS-482)