fix portal crash bug