fix crash on ititial run