Fix unbound method optimization for static types.