fix bugs in if branches, use dyn compatible equality tests, fix anyType as child subtyping through type env