compile-ok version
workable versions for elem and expr