On kernels and nuclei of rank metric codes