Fix a bug in getTitle which led to an out of bound crash