Corrected some functions