added missing check on accountid = -1