More tests and bug fix.