fix vector bug in logical2grid