Some tweaks and bug fixes from October 2011 that apparently I never committed...