change conditions to support more formats