Various issue 

fix lib detection https://bugs.php.net/65539