Bug fixed, checking variable type