Error in registerS3method