Small bug fixes and changes