Fix using $this in closure for php < 5.4