Fixed wrong variable in DB factory functions