Bug fixes

We're getting somewhere!