Fixed bugs, and changed test