fix bug in cost of ships.

add functional test for ship-building.
fix a regression introduced by stacks.