bugfix: added missing "function" keyword
bugfix: replaced var