Better implementation of preParse(). Fixes #505.
Quick fix, because regexes are like black magic. Additional fix for #505.
Additional check for #505. Thanks, @jadwigo.