Ported to 0.4-rc1