Condition for retyping defdef changed.
Added new test cases