More reliable type cast, fix small titles issue