Quick and dirty fix, not tested.