Fix null deref and bad indent