fixing fork logic