fixing undefined js error

@kabum @jakobsack @ringmaster @bantu THX