fixed pagination bug, added validations