find a bug in the original js version