fix calculation broken in previous commit