Fixed logic error with database settings