Adjust id handling to deal with 0 and null