initial fixed version(is working now)