bug fixing for js