Temporary workaround for bug #122, needs proper exception handling.