js browser bug workaround