added another num_elements check and changed print to debug print