Merge pull request #1373 from danmcp/master

Fixing find available algorithm
use correct sort syntax