added memory setting validation, added flush method as prerequisite,
corrected smaller errors on the fly