Better way of fixing bug