fixed undefined variable error.