fixed while() problem between discrepancy with php 5.4 -> 5.5