* ok, fixed some more corner cases. it's getting rather hairy