Fix overriding stage

Before, setting stage in the script was overridden by the stage provided
on the command line. This commit fixes it.