Added some bug fix