Fixed "undefined" bug