Fix writing to external sdcard

Change-Id: Iab941732cf2c65fdfc6d6f838badd24cd16037c5
Merge branch 'cm-11.0' into martincz