Added input echoing
Added error check to XPutImage