Big debugging session

Fix lots of bugs.