fix NPE. getActiveWindow can return null
set -1 as initial value for title indexes
Merge remote-tracking branch 'origin/master'