added ecdsa key nil check