add assertion to primitive functions
clean up and bugfix around error handle
update .gitignore