fixed #563, #562, #558