Check if body is a buffer before casting it