fixed null pointer error on commmon ancestors problem