Bug and consistency fixes.