fixing part of #247 ,thx to tropicdome &jsmb768ypl