fixed a bizzare javascript regex vs string bug