Fix zero checking of command fields and add more tests