Fixed some compiler and runtime issues.