Fix issue 9 and 54

merge in.