This might be unsafe given line 355 below; throw an exception?