changed mask behavior
multiple bugfixes