fixed scope of variables
fixed a problem that cannot hold the user's status