Fix and add tests for zero handling