fixed function bug (php 5.2) #3