inheritance for recurrent layer with search and lm and bug fixes