s3: Remove a nested if-statement