Compatibility with php 5.3

Added closure compatibility with php 5.3