Fixed trial writing condition

Now writes to correct file