fix parent determination bug