Fixed some stack shooting due to a reference of a temporary (issue #40)