preventing app crash