Fix python errors and add error handling