fix undeclared variable use and immediate function call wrapping.