Fix empty page handling