handles db with NAs properly now