modified implementation to work with new API
fixed generics mask
fixed inheritance of generic type