fixed bug in maximum rank computation