Fix before_first and after_last