Quick bug fix introduced when simplifying code