Fixed for ST3 compatibility

With these changes it works with ST3 also