fix type of limit
check for limit==None
remove duplicate code, still can't test locally
dat TypeError error
this should fix the crazy errors
fix logic error in check in cache part