fixed function bug (php 5.2)