Correct syntax for php 5.3 and improve memory management on migration command