Push to v398864

Included changes from pitriss. Thanks for pointing them out ;)