Removed some unnecessary logic that could cause a crash