Ported patches from 0.7.1 to 0.7.2