fixed test function