Corrected bugs in users procedure