Some bug fixes and updates