Fix issues with app crash