expected returns a reference to avoid double-get() problem.
workaround for mingw bug