fixed another bug as pointed out by mdickinson