fixed crashes and some errors, dynamic mode still broken