Fixed missing key brackets and some missing null verifications