fixing if-blocks