added error alert function