Fixed bug caused by half-a**ed refacoring