Fix some bugs and shorten