Bug fixed for investment subroutine