Fixed #477, Fixed #607, Fixed #604