fixing datetime issue + setting database