fixing functions with objects