correct phi calculation for short boundaries