fixes in build scripts
Merged
Added a better findCapability() feature