fixed availablepatches, added resources&distance