fixed bugs found while testing