fixed #260 with @ejnens' help