fixed bug that was introduced by an optimization