fixed analysis of ifs
fixed writes