Minor bug fixes when testing from scratch