added some error detection, sab integration works