still need to fix the missing last line bug