Fixed things suggested by tatsuhiro-t