Fix issue #837 & Fix issue #844