fixing some functions