fixed gh-512: a better error message in the log (failed to allocate memory); a pair of minor fixes