Minor change inside set_boundary method

Now, it returns a better error message.