Fixed some bugs in dynamic implementation