fixed bug in functions