fixed Bug Revealed By Implemented Self Test
Fix errors from previous bug fix