Bug fixes

Crossing more and more bugs off the list.