fix nested conditional grammar
add test