Added function to display errors