fix and tested