Fix errors from previous commits and incorporate suggestion for null check in following method.