Fix logic - keep tmp_data if it already exists
Rewrite testSGP(4) to fit current use cases and run quickly