Improve any() handling #670