fixed bugs added in previous commit :)