Backporting features from master to 0.9-dev