fixed and tested