merged in from the HG version (github rocks)

Signed-off-by: Lensman