fix for ctrl-a bug and efficiency