Fix quantity bugs