added database check for creating new instances