PCMan's patches

Patches PCMan posted here:

https://groups.google.com/group/razor-qt/browse_frm/thread/4a0d5eb94e02a15a