Fix Bug # 935 and Bug # 1052