small updates taken from a patch by Piero Bugoni, crboca32 yahoo com