Fixed too many db calls.