Fixes bug where nil is returned if no substitutions occur.

@dennisvdvliet