fixed and rebased, thanks @elemoine