fixing js bugs, pagination sync functionality