working version, at least on linux