method adapted to php 5.3