Fix scalar whereij and tests