overcoming PHP bug #18556 https://bugs.php.net/bug.php?id=18556