fix to function that was broke