Improving HOIP solar cells by controlling structural instabilities