add code to detect whether incorrect function was used