Fix npe when method is a lambda