cache working, just need to fix segfault