Fix undefined js variable