fixed bugs when testing