support generic type
fix bugs