restire working and tested in all cases