Fix bugs in changing stage