Changed button state detection in mouseup workaround.