Bug fixes; need moar testing