Changes for rand phase in ape_fmt