Finally fixed bug