Minor bug fixes on merge