Some minor improvements and bug fixes.