you are doing intval on $relativeTo on L146 but not here?