Fixed a few stockpile bugs