fixed boundary bug