Fixed error on 'undefined is not a function'.