Add better error reporting