Fix another bug and an issue on OS X 10.5.8