fix #665
#667
Undo my commit for issue #666