Seems alright, just by looking at the code. but at this line
($version !< 6.31)
Dont you mean,
($version != 6.31)