Closes https://github.com/espressif/esp-idf/issues/1480, Closes https://github.com/espressif/esp-idf/issues/1464