Found the source of the bug but not sure why this is happening.