when i try to come out of the heelside turn to go into the toeside turn my board like hesitates and it turns completely 180 degrees and then i start riding switch
When you ride away switch are you on the heelside edge or toeside?
You might be leaning towards the tail when you are trying to transition between turns. This could be one possible cause of the board doing a 180 and switch exit. You can feel this when you are doing a falling leaf. Which ever end of the board you put pressure on will cause that end to go down hill.
Stay centered between your feet while you steer the board into the fall line. Once you're pointed downhill flex your knees and ankles to engage the toeside edge. Stay centered and ride that edge across and up hill. Try this on really flat terrain while your moving slow to gain a feeling for the movement pattern. People often get on the back foot when they are uncomfortable with the speed they are carrying into the turn.