Bug fixes and improvements.
