Fix for critical bug introduced in previous two commits