fixed greedy and size bugs