casting inside and outside