fix race condition on php5.5