Various bug-fixes.