fix log and crashing