Applied patches by Platonides from bugs 9099 and 9255, with review and minor modifica...