fixed off by one bug introduced by previous commit