Fix endif/else pattern matching. Fixes issue#34.