constrain generics bug fix