fixes for wrong regex usage in < PHP 5.3