cleaned up the readonly check in readfile()