fixed bugs from tests