update and fixing bugs