Fix #328
Fix #349 #342