BZ 1070242 - this code was badly broken. fix it up