Fixing js error