fixed null pointer error on page load