Fix #277. Port to 0.6.