Backports 0.6.x to 0.5.x