fixed bug for spaces and underscores in js