Made patch out of mpetrovic's js fix.  #896