FIX: memory leaks removed, checking option in the right context