Fixed signed int comparison issues
Should work correctly on rlogin now