Fix non-idiomatic code