Fixed  initial load error

Added an extra validation for initial page load.