Fix library bugs and fit auto layouts