Fixed ray intersection code bug