adding length check on hash