Fixed an issue with using the wrong element in the mouseup event handler