fixed warning and crash