command/build: fixes reference bugs; #388