fix camera crash in some cases