EMI: Add casts to Layer-functions, to get rid of warnings.