almost perfect
fix some issues