Fix #617 and Final PR for #613