test and fixed bugs