Fix unsigned integer overflow.

Missing parenthesis caused unsigned integer overflow in quicksort
implementation.
Fix garbage collection bug.

Fixes an issue where garbage is being collected multiple times in a
row causing memory issues.