Fixed bug found while reading code