Oh well, with a 32u4 board it works now. A while ago i searched for Mega compatibility with usb communication and i thought that it would work for the keyboard lib, turns out it does not. However before cleaning all arduino files i found, i had the problem even with the supported 32u4 devices.