Fixed name related functions.

They now should give proper lengths and take length into account when
sending.