fixed the various bugs Bobby added.