[FIX] Fixing javascript error due to undefined variables