fixed some bugs;passed username as pparameter