fixed bug with constant detection