I made a scenario where a photon with energy and momentum $(E,p)$ hits an electron with mass $m$, and the electron absorbs the photon and got a contradiction. This implies that this scenario is impossible. I'm writing the contradiction down:
Using energy and momentum conservation:
$$E+mc^2 = E'$$ $$p=p'$$
where $E'$ and $p'$ are the energy and momentum of the moving electron.
Playing around with the formula, and using $E=pc$ for a photon, we get:
$$E+mc^2 = E' \implies pc + mc^2 = E' \implies p'c + mc^2 = E' \neq \sqrt{(p'c)^2+(mc^2)^2}$$
Using the contradiction above, we deduce that a free electron cannot absorb a photon. But how does this happen in the photo electric effect (or the bohr model but I think it's an incorrect model)? What changes in the photoelectric effect that makes the electron able to absorb the photon?