See #47 Now it is more robust