Fixed the return value of fetchKeys in case of errors