Chameleon compatibility changes suggested by RehabMan
merge latest kozlek/master