works when copy and paste from tutorial but not when i typed it myself, cannot see the difference between the two