Fixing hook count glitch and preventing unordered assignment