Bugs fixed.
Simplified `set` method’s logic