fixed #1035 and fixed #1034