adapted module for php 5.5+