fixed compatibility problems

and added eof handling in spec file