Fix NullpointerException when cache times out

Fixes #228