fixed: replace $this in closure with $ctr