small fix in attacking function