bug fix ! and adding guards