bug fixes from where I was being an idiot :-(