trying to track down function define and use bug