fixed null parent check