Fixes for SP, cache the db query