fixed important bugs