TODO: may be throw an exception is better