Fixing randomly broken js