some fixes from Julian Reuth