Fixed wrong window class name

Also added code to print the error code as well when things don't go
right