v2. fixed typo
fix bugs
working v2