fix compare/empty head problems