fixed endif error and added button