fix crash when creating bitmaps

Change-Id: I72982abcfcb0edff35a7000944146e8d924c120f