Some more sanity checks
Fix a couple of small bugs