Fixed EOF issue
Added compatibiliy check.