Better error handling
Added a workaround to make it work in Windows 8.