fix crash on android + clean up