Fix null pointer eception and cache provider
Fixes #55 and fixes #58