bug fixes and prev-next page improvement