added the changes to deal with type compatibility