lots of ugly workarounds