add std library; improved debugging and error message