fixed an initialization issue
wrote more tests to imrpove coverage