rmsd bug fix

fixes issue #69

I also added better tests.