nthomas' fixes