Prevented some crashes related to logging on Android