-Corrected bugs in some functions