Fix #613.
Fix #615
Fix #591
Fix #624