FIXED: replaced some earlier workarounds by propper code.