updated fork logic