tried to fix beam calculating