check pre-conditions
fix bug we were not caching some zero cases