#1 fixed once and for good (I hope). Tests added.