Fixed some build errors and custom commands. Removed code causing warnings because IntPtr can never be null.