Cleaned up devel branch.
Fixed several defects detected by Coverity.