added acutal tests to credit manager and fixed issues discovered in test