fix template condition