Fixes from max's comments