Partial revert of previous commit to remove introduced bug