Movegen and make bugfixing