Fixed a ClassCastException when the method returns a long