Fixes to errors at runtime