Reverted my initial fix, applied sallai suggested fix