fixing js variable error