Some major bug fixes.