fix assert when building cache from scratch (fix #28)