added second unittest and fixed bugs