fixed handling of SELF_TYPE, and tested that