Error handling not working as expected

Erroneous error redirection >2 (output to file named 2) fixed.
Created a fatal_error function for easy error reporting.