add more unit-tests and fix some of them to be compatible with php 5.3