fixing some strnge crashes