fixed undefined error on load