Bug fixes

Fixed 0 upgrade bug, hopefully fixed the function not giving you the max
levels you can buy if you buy more than you can afford