Fix data method when passing a class