Add proper fb locking
Add check for num_bytes
Move update callback to idle function