Fix #665
Fix #605