bugfix: Attempted to assign temporary variable to a const&, broke in debug mode. Fixes #980