Bug Fix, may need refinement