Fixed bug when methods have optional arguments or accept a block.