added IsEmpty and fixed tests