Fixes for config.allow_comments

Implements fixes discussed on #3695