Fixed black screen bug

Fixes for the black screen bug on some device.