numerous minor, but important bug fixes.
minor fix.
another minor fix.