Base: Minor bug fixes and code cleanup