fixing bug discovered by Sijing