Fixed #628 and Fixed #629