fixed the function of returning status