ugly ... but works!