improve status codes and check mime types