fixing bug in currentpage returning null.