The effect of normal and insulating layers on 0-π transitions in Josephson junctions with a ferromagnetic barrier