Fix few small bugs and drop requirement to PHP 5.3