Fixed bug on update & changed priority algorithm