Actually fixed error codes and added directory transversal prevention