Fix bugs and display errors