Don't return flag if flag is already returned (fixes #233)