Maybe the dog became attached with whatever you were picking up. Or maybe there was something of the dog's that was nearby and it thought that you were going to take it. Or the dog just could be very territorial and not like people around when the owner isn't.