Fix writing to external sdcard

Change-Id: Iab941732cf2c65fdfc6d6f838badd24cd16037c5