Fixed lastempty bug