Fix commentsParser regression after #319 had been lost

For some reason part of code from #319 has been lost in master. This PR brings it back, while fixing "TypeError: Cannot read property 'length' of null" from #312

closes #321