Finished test and bug fix