fixed some functions