A few crash fix / bug fix