Fix for #398

@stellanl I looked at it and couldn't help myself :smile:

Can you code check this one please?