Refactored error to ignore zero inputs and fixed some tests