Fixed the last couple of bugs

The should be release ready code until more bugs show up.