Few minor clean ups and possible crash fix.