Ensure that sort function is bound to the right context
Add test for sorting while adding items