Support multiple xs
Fix bugs