use stringutils endwith to avoid nullpointerexceptions