I have no idea why I had made PATH environment variable parsing to be part of the kernel. Now the shell does the parsing and environment syscall is no longer needed.