range attack logic, some fixes