Fix stage lock function (#134)