fixed undefined variable usage