bug fixes and found via ghostest