fix class casting in method proxy