Fix some issues with surface factory on B2G emulator