make sure we have valid lengths