bugfix in resource choosing