Fixed a hard to reproduce bug (did not add test due to bug reproducability complexity