Fix for #408

@loicsans I made the changes. Could you please check? Thanks!