avoid division by 0 in init_input