avoid constructing objects if not needed
Merge pull request #248 from yanns/mini-fixes

avoid constructing objects if not needed