fixed undefined is not a function