fixed error with using empty-S rather than current S