added improved error handling messages and made some fixes to the files api