fixing issues #7 and 5#